package com.example.tests;

import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import org.testng.annotations.Test;
import com.example.fw.ContactObjects;
import com.example.fw.Contacts;

public class AddValidContactTest extends TestBase {
	
	@Test(dataProvider = "contactsFromFile", dataProviderClass = ContactDataGenerator.class)
	public void testValidContactCanBeCreated(ContactObjects fullContact) throws Exception {
		Contacts oldList = app.getContactHelper().getContacts();
		//action
		app.getContactHelper().createContact(fullContact);
		//verification
		Contacts newList = app.getContactHelper().getContacts();
		assertThat(newList, equalTo(oldList.withAdded(fullContact)));
	}
}